﻿using System.Web;
using SecurityClient;

namespace SecurityModule.Workflows
{
    class WFPostHomeLogout : SimpleWorkflow
    {
        public WFPostHomeLogout()
        {
            Verb = "POST";
            Path = "/Home/Logout";
        }

        public override void PreProcessImplementation(HttpContext context)
        {
            // No pre-processing            
        }

        public override void PostProcessImplementation(HttpContext context)
        {
            try
            {
                var security = new SecurityServiceProxy();
                security.Logout();
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch
            // ReSharper restore EmptyGeneralCatchClause
            {
                //If the security service is offline or broken then swallow the exception
            }
        }
    }
}
